package ahg;

import org.junit.Test; 
import robocode.ScannedRobotEvent;
import static org.junit.Assert.*;

/**
 * Tests CakeBot's firing method.
 * @author Tony Gaskell
 *
 */
public class TestCakeBotFiring { 

  /**
   * Tests power of bullets shot depending on distance to target.
   */
  @Test
  public void test() {
    CakeBot cakeBot = new CakeBot();
    cakeBot.moveAmount = 100;
    String name = "Target";
    double energy = 100;
    double bearing = 0;
    double distance = 100;
    double heading = 0;
    double velocity = 0;
    double power = 0;
    
    ScannedRobotEvent scanned;
    
    scanned = new ScannedRobotEvent(name, energy, bearing, distance, heading, velocity);
    power = cakeBot.smartShot(scanned);
    assertEquals(1, power, 3);
    System.out.println("Power 1 shot: Passed!");
    
    scanned = new ScannedRobotEvent(name, energy, bearing, (distance / 3), heading, velocity);
    power = cakeBot.smartShot(scanned);
    assertEquals(2, power, 3);
    System.out.println("Power 2 shot: Passed!");
    
    scanned = new ScannedRobotEvent(name, energy, bearing, (2 * distance / 3), heading, velocity);
    power = cakeBot.smartShot(scanned);
    assertEquals(3, power, 3);
    System.out.println("Power 3 shot: Passed!");
  }
}
